#constants

HTML_V   = html/view/*.html
HTML_P   = html/print/*.html
HTML_SRC = src/*.xml

IMG_V   = html/view/images/*.png
IMG_P   = html/print/images/*.png
IMG_SRC = src/images/*.png

CSS_V   = html/view/res/default.css
CSS_P   = html/print/res/default.css
CSS_SRC = src/res/default.css

#main target

all: view

#view target

view: $(HTML_V) $(IMG_V) $(CSS_V)

$(HTML_V): $(HTML_SRC)
	xsltproc --nonet xslt/driver.xsl src/lab1.xml

$(IMG_V): $(IMG_SRC)
	mkdir -p `dirname $(IMG_V)`
	cp $(IMG_SRC) `dirname $(IMG_V)`

$(CSS_V): $(CSS_SRC)
	mkdir -p `dirname $(CSS_V)`
	cp $(CSS_SRC) `dirname $(CSS_V)`

#print target

print: $(HTML_P) $(IMG_P) $(CSS_P)

$(HTML_P): $(HTML_SRC)
	xsltproc --nonet xslt/print.xsl src/lab1.xml

$(IMG_P): $(IMG_SRC)
	mkdir -p `dirname $(IMG_P)`
	cp $(IMG_SRC) `dirname $(IMG_P)`

$(CSS_P): $(CSS_SRC)
	mkdir -p `dirname $(CSS_P)`
	cp $(CSS_SRC) `dirname $(CSS_P)`

#clean target

clean:
	rm -rf html/*



#printhtml: $(HTML1_SRC)
#	mkdir -p html/lab1/print/
#	xsltproc --nonet lab1/print.xsl lab1/lab1.xml
#	xsltproc --nonet lab1/print.xsl lab1/lab1.xml >html/lab1/print/lab1.fo
#	mkdir -p html/lab1/print/images/
#	cp lab1/images/* html/lab1/print/images/
#	mkdir -p html/lab1/print/res/
#	cp style/default.css html/lab1/print/res/
